
var indexUserName;
var indexPhone;
var indexAddress;

function InsertIndexHuiKanhomepage(){

	indexUserName = document.getElementById("txtIndexUserName").value;
	indexPhone = document.getElementById("txtIndexPhone").value;
	indexAddress = document.getElementById("txtIndexAddress").value;

	if (indexUserName == ""){
		alert("请输入您的姓名！");
		return false;
	}
	if (indexPhone == ""){
		alert("请输入您的电话！");
		return false;
	}
     if (indexAddress == ""){
		alert("请输入您的电话！");
		return false;
	}
//addNumber('GET','/demand.php?act=email_list_dfsd&indexUserName='+indexUserName+'&indexPhone='+indexPhone+"&indexAddress="+indexAddress,true,suo_yao);

    var url = '/demand.php?act=email_list_dfsd&indexUserName='+indexUserName+'&indexPhone='+indexPhone+"&indexAddress="+indexAddress;

    $.getJSON(url, function(json){
		if(json != null){
				if(json.boo == "1"){//操作成功
					alert("您已经索取成功！");
                    $("#pop").hide();
				}else{
					alert("出现异常，索取失败！");
				}
		}else {
			alert("出现异常，提交没有成功！");
		}
	});


}
/*
function suo_yao(xmlHttp,parameter,Unsuccessful)
{//alert(xmlHttp.responseText.length);
if(xmlHttp.responseText.length > 0 )
    {
    //alert(xmlHttp.responseText);
    alert("您已经提交成功！");

    return false;

    }
}
*/

function showMsg() { showDiv($("#pop")); }
   function closeMsg() { $("#pop").hide(); }
   function showDiv(obj) {
       $(obj).show();
       center(obj);
       $(window).scroll(function() {
           center(obj);
       });
       $(window).resize(function() {
           center(obj);
       });
   }
   function center(obj) {
       var windowWidth = document.documentElement.clientWidth;
       var windowHeight = document.documentElement.clientHeight;
       var popupHeight = $(obj).height();
       var popupWidth = $(obj).width();
       $(obj).css({
           "position": "absolute",
           "background-color": "#ffffff",
           "top": (windowHeight - popupHeight) / 2 + document.documentElement.scrollTop,
           "left": (windowWidth - popupWidth) / 2
       });
   }
  // $(document).ready(function() { center($("#pop")) });
//<![CDATA[
//首页标签切换 购物车登陆和直接购买也是此代码zjj
$(function(){
   var $div_li =$("div.in_t ul li");
   $div_li.mouseover(function(){

$(this).addClass("in_boxhover")            //当前<li>元素高亮
  .siblings().removeClass("in_boxhover");  //去掉其它同辈<li>元素的高亮
            var index =  $div_li.index(this);  // 获取当前点击的<li>元素 在 全部li元素中的索引。

$("div.in_b > div")   //选取子节点。不选取子节点的话，会引起错误。如果里面还有div
.eq(index).show()   //显示 <li>元素对应的<div>元素
.siblings().hide(); //隐藏其它几个同辈的<div>元素
})
})



//图片轮换开始
var userMenuTimeOut=null;
jQuery(function($){
	if($(".slide-pic").length>0)
	{
		var defaultOpts = { interval: 5000, fadeInTime: 300, fadeOutTime: 200 };
		var _titles = $("ul.slide-txt li");
		var _titles_bg = $("ul.op li");
		var _bodies = $("ul.slide-pic li");
		var _count = _titles.length;
		var _current = 0;
		var _intervalID = null;
		var stop = function() { window.clearInterval(_intervalID); };
		var slide = function(opts) {
			if (opts) {
				_current = opts.current || 0;
			} else {
				_current = (_current >= (_count - 1)) ? 0 : (++_current);
			};
			_bodies.filter(":visible").fadeOut(defaultOpts.fadeOutTime, function() {
				_bodies.eq(_current).fadeIn(defaultOpts.fadeInTime);
				_bodies.removeClass("cur").eq(_current).addClass("cur");
			});
			_titles.removeClass("cur").eq(_current).addClass("cur");
			_titles_bg.removeClass("cur").eq(_current).addClass("cur");
		};
		var go = function() {
			stop();
			_intervalID = window.setInterval(function() { slide(); }, defaultOpts.interval);
		};
		var itemMouseOver = function(target, items) {
			stop();
			var i = $.inArray(target, items);
			slide({ current: i });
		};
		_titles.hover(function() { if($(this).attr('class')!='cur'){itemMouseOver(this, _titles); }else{stop();}}, go);
		_bodies.hover(stop, go);
		go();
	}
});
jQuery(function($){
	if($(".slide-pic1").length>0)
	{
		var defaultOpts = { interval: 5000, fadeInTime: 300, fadeOutTime: 200 };
		var _titles = $("ul.slide-txt1 li");
		var _titles_bg = $("ul.op1 li");
		var _bodies = $("ul.slide-pic1 li");
		var _count = _titles.length;
		var _current = 0;
		var _intervalID = null;
		var stop = function() { window.clearInterval(_intervalID); };
		var slide = function(opts) {
			if (opts) {
				_current = opts.current || 0;
			} else {
				_current = (_current >= (_count - 1)) ? 0 : (++_current);
			};
			_bodies.filter(":visible").fadeOut(defaultOpts.fadeOutTime, function() {
				_bodies.eq(_current).fadeIn(defaultOpts.fadeInTime);
				_bodies.removeClass("cur1").eq(_current).addClass("cur1");
			});
			_titles.removeClass("cur1").eq(_current).addClass("cur1");
			_titles_bg.removeClass("cur1").eq(_current).addClass("cur1");
		};
		var go = function() {
			stop();
			_intervalID = window.setInterval(function() { slide(); }, defaultOpts.interval);
		};
		var itemMouseOver = function(target, items) {
			stop();
			var i = $.inArray(target, items);
			slide({ current: i });
		};
		_titles.hover(function() { if($(this).attr('class')!='cur1'){itemMouseOver(this, _titles); }else{stop();}}, go);
		_bodies.hover(stop, go);
		go();
	}
});
jQuery(function($){
	if($(".slide-pic2").length>0)
	{
		var defaultOpts = { interval: 5000, fadeInTime: 300, fadeOutTime: 200 };
		var _titles = $("ul.slide-txt2 li");
		var _titles_bg = $("ul.op2 li");
		var _bodies = $("ul.slide-pic2 li");
		var _count = _titles.length;
		var _current = 0;
		var _intervalID = null;
		var stop = function() { window.clearInterval(_intervalID); };
		var slide = function(opts) {
			if (opts) {
				_current = opts.current || 0;
			} else {
				_current = (_current >= (_count - 1)) ? 0 : (++_current);
			};
			_bodies.filter(":visible").fadeOut(defaultOpts.fadeOutTime, function() {
				_bodies.eq(_current).fadeIn(defaultOpts.fadeInTime);
				_bodies.removeClass("cur2").eq(_current).addClass("cur2");
			});
			_titles.removeClass("cur2").eq(_current).addClass("cur2");
			_titles_bg.removeClass("cur2").eq(_current).addClass("cur2");
		};
		var go = function() {
			stop();
			_intervalID = window.setInterval(function() { slide(); }, defaultOpts.interval);
		};
		var itemMouseOver = function(target, items) {
			stop();
			var i = $.inArray(target, items);
			slide({ current: i });
		};
		_titles.hover(function() { if($(this).attr('class')!='cur2'){itemMouseOver(this, _titles); }else{stop();}}, go);
		_bodies.hover(stop, go);
		go();
	}
});
jQuery(function($){
	if($(".slide-pic3").length>0)
	{
		var defaultOpts = { interval: 5000, fadeInTime: 300, fadeOutTime: 200 };
		var _titles = $("ul.slide-txt3 li");
		var _titles_bg = $("ul.op3 li");
		var _bodies = $("ul.slide-pic3 li");
		var _count = _titles.length;
		var _current = 0;
		var _intervalID = null;
		var stop = function() { window.clearInterval(_intervalID); };
		var slide = function(opts) {
			if (opts) {
				_current = opts.current || 0;
			} else {
				_current = (_current >= (_count - 1)) ? 0 : (++_current);
			};
			_bodies.filter(":visible").fadeOut(defaultOpts.fadeOutTime, function() {
				_bodies.eq(_current).fadeIn(defaultOpts.fadeInTime);
				_bodies.removeClass("cur3").eq(_current).addClass("cur3");
			});
			_titles.removeClass("cur3").eq(_current).addClass("cur3");
			_titles_bg.removeClass("cur3").eq(_current).addClass("cur3");
		};
		var go = function() {
			stop();
			_intervalID = window.setInterval(function() { slide(); }, defaultOpts.interval);
		};
		var itemMouseOver = function(target, items) {
			stop();
			var i = $.inArray(target, items);
			slide({ current: i });
		};
		_titles.hover(function() { if($(this).attr('class')!='cur3'){itemMouseOver(this, _titles); }else{stop();}}, go);
		_bodies.hover(stop, go);
		go();
	}
});
jQuery(function($){
	if($(".slide-pic4").length>0)
	{
		var defaultOpts = { interval: 5000, fadeInTime: 300, fadeOutTime: 200 };
		var _titles = $("ul.slide-txt4 li");
		var _titles_bg = $("ul.op4 li");
		var _bodies = $("ul.slide-pic4 li");
		var _count = _titles.length;
		var _current = 0;
		var _intervalID = null;
		var stop = function() { window.clearInterval(_intervalID); };
		var slide = function(opts) {
			if (opts) {
				_current = opts.current || 0;
			} else {
				_current = (_current >= (_count - 1)) ? 0 : (++_current);
			};
			_bodies.filter(":visible").fadeOut(defaultOpts.fadeOutTime, function() {
				_bodies.eq(_current).fadeIn(defaultOpts.fadeInTime);
				_bodies.removeClass("cur4").eq(_current).addClass("cur4");
			});
			_titles.removeClass("cur4").eq(_current).addClass("cur4");
			_titles_bg.removeClass("cur4").eq(_current).addClass("cur4");
		};
		var go = function() {
			stop();
			_intervalID = window.setInterval(function() { slide(); }, defaultOpts.interval);
		};
		var itemMouseOver = function(target, items) {
			stop();
			var i = $.inArray(target, items);
			slide({ current: i });
		};
		_titles.hover(function() { if($(this).attr('class')!='cur4'){itemMouseOver(this, _titles); }else{stop();}}, go);
		_bodies.hover(stop, go);
		go();
	}
});
//图片轮换结束
//限时抢购切换

$(function(){
 $('div.sid4_t span:first').addClass('sid4_hover');
 $('div.sliding_4 ul:first').css('display','block');
 autoroll();
 hookThumb();
});
var i=-1; //第i+1个tab开始
var offset = 9000; //轮换时间
var timer = null;
function autoroll(){
 n = $('div.sid4_t span').length-1;

 i++;
 if(i > n){
 i = 0;
 }
 slide(i);
    timer = window.setTimeout(autoroll, offset);
 }
function slide(i){

 $('div.sliding_4 ul').eq(i).css('display','block').siblings('div.sliding_4 ul').css('display','none');
 $('div.sid4_t span').eq(i).addClass('sid4_hover').siblings('div.sid4_t span').removeClass('sid4_hover');

 }
function hookThumb(){

 $('div.sid4_t span').hover(

  function () {
    if (timer) {
                clearTimeout(timer);
    i = $(this).prevAll().length;
             slide(i);
            }
  },
  function () {

            timer = window.setTimeout(autoroll, offset);
            this.blur();
            return false;
  }
);
}


//本周排行榜
function MM_setDivType(ByTepy,type,countTYPE){
	for (currID=0; currID<countTYPE; currID++){
		if (parseInt(type)==currID){
			document.getElementById(ByTepy+'U'+currID).style.display="block";
			document.getElementById(ByTepy+'S'+currID).style.display="block";
			document.getElementById(ByTepy+'D'+currID).style.display="none";
		}
		else{
			document.getElementById(ByTepy+'U'+currID).style.display="none";
			document.getElementById(ByTepy+'S'+currID).style.display="none";
			document.getElementById(ByTepy+'D'+currID).style.display="block";
		}
	}
}
//发货信息向上滚动
$(function(){
msgmove('#lunhuanA');
$("#lunhuanA ul").hover(function(){
$(this).attr("name","hovered"); //鼠标经过设置ul的name值为"hovered"
},function(){
$(this).removeAttr("name");
});
});


function msgmove(){var isIE=!!window.ActiveXObject;
var isIE6=isIE&&!window.XMLHttpRequest;
if($("#lunhuanA ul").attr("name") != "hovered"){
//判断ul的name属性是否为"hovered"，决定下面代码块是否运行，以实现鼠标经过暂停滚动。
var height = $("#lunhuanA li:last").height();
if(isIE6){
//判断IE6，jQuery的animate动画和opacity透明在一起使用在IE6中会出现中文重影现象，
//所以在ie6中实行透明的禁用。
$("#lunhuanA ul li:last").css({"height":0});
}else{ $("#lunhuanA ul li:last").css({"opacity":0,"height":0});
//列表最后的li透明和高度设置为0 }
$("#lunhuanA ul li:first").before($("#lunhuanA ul li:last"));
//把列表最后的li提升到顶部，实现有限列表项无限循环滚动显示
$("#lunhuanA ul li:first").animate({"height":height},300);
//列表顶部的li高度逐渐变高以把下面的li推下去 if(!isIE6){
$("#lunhuanA ul li:first").animate({"opacity":"1"},300);
//在非IE6浏览器中设置透明淡入效果
}
}
setTimeout("msgmove()",5000);
//设置5秒滚动一次
}
//发货信息向上滚动end


//即时热卖榜向上滚动
$(function(){
msgmove2();
$("#lunhuanA2 ul").hover(function(){
$(this).attr("name","hovered"); //鼠标经过设置ul的name值为"hovered"
},function(){
$(this).removeAttr("name");
});
});


function msgmove2(){var isIE=!!window.ActiveXObject;
var isIE6=isIE&&!window.XMLHttpRequest;
if($("#lunhuanA2 ul").attr("name") != "hovered"){

var height = $("#lunhuanA2 li:last").height();
if(isIE6){

$("#lunhuanA2 ul li:last").css({"height":0});
}else{ $("#lunhuanA2 ul li:last").css({"opacity":0,"height":0});

$("#lunhuanA2 ul li:first").before($("#lunhuanA2 ul li:last"));

$("#lunhuanA2 ul li:first").animate({"height":height},300);

$("#lunhuanA2 ul li:first").animate({"opacity":"1"},300);

}
}
setTimeout("msgmove2()",5000);

}


